import {FC} from "react";
import {Button} from "antd";
import {CommonButtonPropsInterface} from "../../../types/interface/form.control.interface";
import {createComponentProperty} from "../translate/ComponentFactory";

const CommonButtonComponent: FC<CommonButtonPropsInterface> = (
    {text, control, onComponentCreated ,handelId}) => {
    const handleClick = () => {
        const newComponentProperty = createComponentProperty(control);
        if (onComponentCreated) {
            onComponentCreated(newComponentProperty);
        }
    };

    return (
        <Button className="CommonButtonComponent" onClick={handleClick}>
            {text}
        </Button>
    );
};

export default CommonButtonComponent;